package com.lorenzogao.pley.ui.data.http


import com.lorenzogao.pley.bean.*
import com.lorenzogao.pley.bean.requestbean.LoginRequestBean
import io.reactivex.Observable
import retrofit2.http.*


/**
 * Created by GanLanPing
 * data:2017/12/22
 * time:23:16
 * 邮箱:2508719070@qq.com
 * Description:
 */

interface ApiService {
    companion object {
        val BASE_URL: String = "http://112.124.22.238:8081/course_api/cniaoplay/"


    }

// @GET("/course_api/cniaoplay/featured")
//    fun getApps(@Query("p") jsonParam:String): Call<PageBean<AppInfo>>


    @GET("featured2")
    fun getApps(@Query("p") jsonParam: String): Observable<BaseBean<PageBean<AppInfo>>>


    @GET("toplist")
    fun toplist(@Query("page") page: Int): Observable<BaseBean<PageBean<AppInfo>>>


    @GET("game")
    fun games(@Query("page") page: Int): Observable<BaseBean<PageBean<AppInfo>>>

    @GET("index")
    fun index(): Observable<BaseBean<IndexBean>>

    @POST("login")
    fun login(@Body bean: LoginRequestBean): Observable<BaseBean<LoginBean>>

    @GET("category")
    fun getCategories(): Observable<BaseBean<List<Category>>>

    @GET("category/featured/{categoryid}")
    fun getFeaturedAppByCategory(@Path("categoryid") category: Int, @Query("page") page: Int): Observable<BaseBean<PageBean<AppInfo>>>

    @GET("category/toplist/{categoryid}")
    fun getTopListAppByCategory(@Path("categoryid") category: Int, @Query("page") page: Int): Observable<BaseBean<PageBean<AppInfo>>>


    @GET("category/newlist/{categoryid}")
    fun getNewListAppByCategory(@Path("categoryid") category: Int, @Query("page") page: Int): Observable<BaseBean<PageBean<AppInfo>>>


    @GET("app/{id}")
    fun getAppDetail(@Path("id") id: Int): Observable<BaseBean<AppInfo>>

}
